<template>
    <slot></slot>
    <button @click="hello">测试触发test事件</button>
</template>
<script>
    export default {
        name: 'Demo',
        props: ['num1', 'num2'],//num2在上下文的attrs
        // emits: ['test'],
        // setup() {
        //     console.log('你好a');
        // console.log(this);  //undefined
        // },
        //setup建立快过mounted
        // beforeCreate() {
        //     console.log('你好啊');
        // },
        setup(props, context) {
            function hello() {
                context.emit('test')
            }
            console.log(props, context);

            return {
                hello
            }

        }


    }  
</script>
<style>
</style>